package com.group.itms.routes.provider;


public class ProviderException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5789450411750134004L;

	public static final int IO_EXCEPTION = 10;
	public static final int JSON_EXCEPTION = 11;

	private int type;

	public ProviderException(String message) {
		super(message);
	}

	public ProviderException(String message, Throwable cause) {
		this(message, cause, 0);
	}
	
	public ProviderException(Throwable cause, int type) {
		this("", cause, type);
	}
	
	public ProviderException(String message, Throwable cause, int type) {
		super(message, cause);
		setType(type);
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		if (type != IO_EXCEPTION && type != JSON_EXCEPTION) {
			throw new RuntimeException("Unknown type - ProviderException");
		}
		this.type = type;
	}

}
